// 路由权限校验
import router from "@/router/index";

router.beforeEach((to, from, next) => {
    const token = localStorage.getItem('edb-authorization-token')
    // 判断是否有token 还需判断token是否与登录时一致
    if (token !== null) {
        if (to.path === '/login') {
            next('/')
        } else {
            next()
        }
    } else { // 无toke时
        if (to.path !== '/login') {
            next('/login')
        } else {
            next()
        }
    }

})
